var util = require('../../utils/util.js');
var ajax = require('../../utils/ajax.js');

Page({
    data: {
        dataLoaded: false,
    },

    onLoad() {

        this.setData({
            dataLoaded: true,
        });
    },

    _tx(e) {
        var _self = this;
        var regex = new RegExp("[\\u4E00-\\u9FFF]+", "g");
        if (!(e.detail.value && regex.test(e.detail.value.name))) {
            util.alert('姓名不能为空且必须是汉字');
            return false;
        }
        ajax.P('/openapi/User/doUserWithdraw', e.detail.value, function(d) {
            if (d.code == 0) {
                util.alert('提现审核提交成功', function() {
                    wx.switchTab({
                        url: '/pages/mine/mine'
                    });
                });
            } else {
                if (d.msg) {
                    util.alert(d.msg);
                }
            }
        });

    }

});